//
//  PictureTableViewCell.swift
//  SwiftStudy
//
//  Created by wangyuxiang on 2018/2/6.
//  Copyright © 2018年 chang. All rights reserved.
//

import UIKit
import SDWebImage

class PictureTableViewCell: UITableViewCell {

    var pictureView = UIImageView.init()
    
    func refresh(model: PictureModel) -> Void {
        pictureView.frame = CGRect.init(x: MAINSCREEN_WIDTH * 0.125, y: 10, width: MAINSCREEN_WIDTH * 0.75, height: MAINSCREEN_WIDTH * 0.75 * (model.height / model.width))
        pictureView.backgroundColor = UIColorFromRGB(rgbValue: 0xededed)
        pictureView.layer.cornerRadius = 8;
        pictureView.layer.masksToBounds = true
        pictureView.sd_setImage(with: URL.init(string: model.url), completed: nil)
        self.contentView.addSubview(pictureView)
    }
}
